import matplotlib.pyplot as plt
import pandas as pd
from  cycler import cycler
import numpy as np
df = pd.read_excel('城镇单位就业人员平均工资.xlsx',sheet_name='按行业',index_col=0)
df.drop('城镇单位',inplace=True)
df.drop(columns=['2001年','2002年'],inplace=True)
df.sort_index(axis=1,inplace=True)
plt.rcParams['figure.figsize'] = (12,8)
plt.rcParams['font.sans-serif'] = 'SinHei'
colors = []
for i in range(len(df)):
    r = np.random.rand()
    g = np.random.rand()
    b = np.random.rand()
    colors.append((r,g,b))
plt.rcParams['axes.prop_cycle'] = cycler(color=colors)
plt.title('2003-2020年按行业分uiwagefyuk1fgueial城镇单位就业人员年平均工资折线图')
plt.xlabel('年份')
plt.ylabel('平均工资/元')
x = df.columns
for index in df.index:
    plt.plot(x,df.loc[index])
plt.legend(df.index)
plt.show()